package com.hjm.project.download.service.impl;

import com.hjm.common.utils.DateUtils;
import com.hjm.project.download.domain.Download;
import com.hjm.project.download.mapper.DownloadMapper;
import com.hjm.project.download.service.IDownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hjm.common.utils.text.Convert;

import java.util.List;

/**
 * app下载记录Service业务层处理
 * 
 * @author generator
 * @date 2020-11-26
 */
@Service
public class DownloadServiceImpl implements IDownloadService
{
    @Autowired
    private DownloadMapper downloadMapper;

    /**
     * 查询app下载记录
     * 
     * @param id app下载记录ID
     * @return app下载记录
     */
    @Override
    public Download selectDownloadById(Long id)
    {
        return downloadMapper.selectDownloadById(id);
    }

    /**
     * 查询app下载记录列表
     * 
     * @param download app下载记录
     * @return app下载记录
     */
    @Override
    public List<Download> selectDownloadList(Download download)
    {
        return downloadMapper.selectDownloadList(download);
    }

    /**
     * 新增app下载记录
     * 
     * @param download app下载记录
     * @return 结果
     */
    @Override
    public int insertDownload(Download download)
    {
        download.setCreateTime(DateUtils.getNowDate());
        return downloadMapper.insertDownload(download);
    }

    /**
     * 修改app下载记录
     * 
     * @param download app下载记录
     * @return 结果
     */
    @Override
    public int updateDownload(Download download)
    {
        download.setUpdateTime(DateUtils.getNowDate());
        return downloadMapper.updateDownload(download);
    }

    /**
     * 删除app下载记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteDownloadByIds(String ids)
    {
        return downloadMapper.deleteDownloadByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除app下载记录信息
     * 
     * @param id app下载记录ID
     * @return 结果
     */
    @Override
    public int deleteDownloadById(Long id)
    {
        return downloadMapper.deleteDownloadById(id);
    }
}
